import 'package:demo/app/modules/apply/base_info/tab1/tab1_view.dart';
import 'package:demo/app/modules/apply/base_info/tab2/tab2_view.dart';
import 'package:demo/app/modules/apply/base_info/tab3/tab3_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:get/get.dart';

import '../../../../theme/app_colors.dart';
import '../../../../theme/app_text_theme.dart';
import 'base_info_controller.dart';

class BaseInfoView extends GetView<BaseInfoController> {
  const BaseInfoView({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Obx(() => Scaffold(
      backgroundColor: Color_bg,
      appBar: AppBar(
          title: Text('基本信息',style: text_title_black)
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            Container(
              color: const Color(0xFFE9F7FE),
              padding: EdgeInsets.symmetric(horizontal: 15.w,vertical: 9.w),
              width: Get.width,
              child: Text('完成以下认证为您定制最合适的贷款方案' ,style: text_main_12)),
            Container(
              padding: EdgeInsets.symmetric(vertical: 20.w),
              alignment:Alignment.center,
              width: Get.width,
              child: Row(
                mainAxisSize : MainAxisSize.min,
                children: [
                Container(
                   alignment:Alignment.center,
                   width:20.w,
                   height:20.w,
                   decoration: BoxDecoration(
                       color: Color_main,
                       borderRadius: BorderRadius.all(Radius.circular(10.w))
                   ),
                   child: Text(controller.currentIndex.value == 0 ? '1':'✓',style: text_white_12)
                ),
                Container(
                    width:80.w,
                    height:1,
                    color: controller.currentIndex.value >= 1?Color_main:Color_grey,
                ),
                Container(
                    alignment:Alignment.center,
                    width:20.w,
                    height:20.w,
                    decoration: BoxDecoration(
                        color: controller.currentIndex.value >= 1?Color_main:Color_grey,
                        borderRadius: BorderRadius.all(Radius.circular(10.w))
                    ),
                    child: Text(controller.currentIndex.value == 2 ? '✓':'2',style: text_white_12)
                ),
                Container(
                  width:80.w,
                  height:1,
                  color: controller.currentIndex.value == 2?Color_main:Color_grey,
                ),
                Container(
                    alignment:Alignment.center,
                    width:20.w,
                    height:20.w,
                    decoration: BoxDecoration(
                        color: controller.currentIndex.value == 2?Color_main:Color_grey,
                        borderRadius: BorderRadius.all(Radius.circular(10.w))
                    ),
                    child: Text('3',style: text_white_12)
                )
              ])
            ),
            getPages()[controller.currentIndex.value],
        ]),
      ),
    ));
  }

  List<Widget> getPages (){
    List<Widget> list = [];
    list.add(const Tab1View());
    list.add(const Tab2View());
    list.add(const Tab3View());
    return list;
  }
}
